package com.linliusheng.service;

import javax.swing.*;
import java.awt.*;

public class AdminView extends JFrame {
    private JMenuBar bar;
    private JMenu menuBook,menuUser,menuBorrowBook,menuFine, menuPersonalInformation, menuLoginOut;

    private JLabel titleLabel;
    private JMenuItem itemBookAdd,itemBookSelect,itemReaderSelect,
            itemBookTypeManage,itemReaderTypeManage,itemUserAdd,itemBookmessage,
            itemUserDelete,itemUserUpdate,itemBookBorrow,itemBookReturn,itemFineamount, itemUpdateInformation, itemChangePwd;
    String[] columnNames = {"书名", "作者","出版社", "ISBN","图书类型", "价格"};
    String [][] tempLine={
            {"1","1","","","",""}
    };
    private JTable hotBookTable;
    private JScrollPane tableJScrollPane;

    private Font font;
    public AdminView(){
        super("图书管理系统");
        setSize(1200,700);
        setLocationRelativeTo(null);
        bar = new JMenuBar();
        setJMenuBar(bar);
        setResizable(false);
        setLayout(null);
        fontSet();
        //菜单栏
        barSet();
        //标签设置
        labelSet();
        //热门图书表格
        tableSet();

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public void labelSet() {
        titleLabel = new JLabel("热 门 图 书");
        titleLabel.setBounds(470, 10, 200, 50);
        titleLabel.setFont(font);
        add(titleLabel);
    }

    public void barSet() {
        menuBook=new JMenu("图书信息管理");

        itemBookAdd=new JMenuItem("图书添加");
        itemBookSelect=new JMenuItem("图书查询与修改");
        itemBookTypeManage = new JMenuItem("图书类型管理");

        menuBook.add(itemBookAdd);
        menuBook.add(itemBookSelect);
        menuBook.add(itemBookTypeManage);

        menuUser = new JMenu("用户信息管理");

        itemUserAdd = new JMenuItem("添加用户");
        itemReaderSelect = new JMenuItem("用户查询与修改");
        itemReaderTypeManage = new JMenuItem("用户类型管理");
        itemUserDelete = new JMenuItem("删除用户");
        itemUserUpdate = new JMenuItem("修改密码");

        menuUser.add(itemUserAdd);
        menuUser.add(itemReaderSelect);
        menuUser.add(itemReaderTypeManage);
        menuUser.add(itemUserDelete);
        menuUser.add(itemUserUpdate);


        menuBorrowBook = new JMenu("借阅信息管理");

        itemBookBorrow = new JMenuItem("图书借阅");
        itemBookReturn = new JMenuItem("图书归还");
        itemBookmessage = new JMenuItem("借阅信息");

        menuBorrowBook.add(itemBookBorrow);
        menuBorrowBook.add(itemBookReturn);
        menuBorrowBook.add(itemBookmessage);


        menuFine = new JMenu("罚款信息管理");

        itemFineamount = new JMenuItem("罚款信息");
        menuFine.add(itemFineamount);

        menuPersonalInformation = new JMenu("个人信息管理");
        itemUpdateInformation = new JMenuItem("个人中心");
        itemChangePwd = new JMenuItem("修改密码");
        menuPersonalInformation.add(itemUpdateInformation);
        menuPersonalInformation.add(itemChangePwd);

        menuLoginOut = new JMenu("退出登录");
        bar.add(menuBook);
        bar.add(menuUser);
        bar.add(menuBorrowBook);
        bar.add(menuFine);
        bar.add(menuPersonalInformation);
        bar.add(menuLoginOut);

    }
    public void tableSet() {
        hotBookTable = new JTable(tempLine, columnNames);
        tableJScrollPane = new JScrollPane(hotBookTable);
        tableJScrollPane.setBounds(0, 70,1200,300);
        add(tableJScrollPane);
    }
    public void fontSet() {
        font = new Font("黑体", Font.BOLD, 27);
    }
    public static void main(String[] args) {
        new AdminView();
    }
}






